package com.naojump.util;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.util.ArrayList;
import java.util.List;

/**
 * naojump Utilities
 * 
 * @author Naoto Murata
 * @since 1
 * @version 4
 */
final public class NUtils {

    /**
     * Checks what string has character. (s != null) && ("".equals(s));<br>
     * 
     * @param s
     *            string
     * @return true or false
     */
    public static boolean hasChar(String s) {
        return s != null && s.length() >= 1;
    }

    /**
     * Converts NodeList to List&lt;Node&gt;.
     * 
     * @param nodeList
     *            NodeList
     * @return List&lt;Node&gt;
     */
    public static List<Node> lconv(NodeList nodeList) {
        List<Node> list = new ArrayList<Node>();
        for (int i = 0; i < nodeList.getLength(); i++) {
            list.add(nodeList.item(i));
        }
        return list;
    }

    /** Private constructor */
    private NUtils() {
        //
    }

}
